package com.automannn.atm_back.modules.system.service;

import com.automannn.atm_back.common.exception.AtmBackException;
import com.automannn.atm_back.modules.system.entity.SysPermission;
import com.automannn.atm_back.modules.system.model.TreeModel;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;

/**
 * 菜单权限表 服务类
 * @author chenkh
 * @time 2020/6/26 22:02
 */
public interface ISysPermissionService extends IService<SysPermission> {
     List<TreeModel> queryListByParentId(String parentId);

    /**真实删除*/
     void deletePermission(String id) throws AtmBackException;
    /**逻辑删除*/
     void deletePermissionLogical(String id) throws AtmBackException;

     void addPermission(SysPermission sysPermission) throws AtmBackException;

     void editPermission(SysPermission sysPermission) throws AtmBackException;

     List<SysPermission> queryByUser(String username);

    /**
     * 根据permissionId删除其关联的SysPermissionDataRule表中的数据
     *
     * @param id
     * @return
     */
     void deletePermRuleByPermId(String id);

    /**
     * 查询出带有特殊符号的菜单地址的集合
     * @return
     */
     List<String> queryPermissionUrlWithStar();

    /**
     * 判断用户否拥有权限
     * @param username
     * @param sysPermission
     * @return
     */
     boolean hasPermission(String username, SysPermission sysPermission);

    /**
     * 根据用户和请求地址判断是否有此权限
     * @param username
     * @param url
     * @return
     */
     boolean hasPermission(String username, String url);
}
